package org.springframework.web.servlet.ajax.json;

import java.util.Locale;

import org.springframework.core.Ordered;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;

/**
 * @author Charles Tassoni
 */

//TODO: May end up figuring out all the other view resolvers rather than simply
//being given a delegate.
public class HoldsContentViewResolver implements ViewResolver, Ordered {
	private int order;
	private ViewResolver delegate;


	public void setDelegate(ViewResolver delegate) {
		this.delegate = delegate;
	}

	public View resolveViewName(String viewName, Locale locale) throws Exception{
		View  view = delegate.resolveViewName(viewName, locale);
		HoldsContentView holdsContentView = new HoldsContentView();
		holdsContentView.setDelegate(view);
		return  holdsContentView;
	}

	public int getOrder() {
		return this.order;
	}
	public void setOrder(int order){
		this.order = order;
	}





}
